package com.scs.application.core.pdf.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.scs.application.core.pdf.enums.TextShowType;
import com.scs.application.core.pdf.json.EnumDeserializer;
import com.scs.application.core.pdf.json.EnumSerializer;
import com.itextpdf.layout.property.TextAlignment;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
 * @Description： PDF导出表格列
 */
@Data
@Accessors(chain = true)
@NoArgsConstructor
public class PdfExportGridColumn {

    private String field;

    private String label;

    private int span;

    /** 汇总 */
    private boolean summary;

    private String format;

    private int height = 20;

    private int fontSize = 12;

    @JSONField(serializeUsing = EnumSerializer.class, deserializeUsing = EnumDeserializer.class)
    private TextShowType textShowType = TextShowType.PLAIN;

    @JSONField(serializeUsing = EnumSerializer.class, deserializeUsing = EnumDeserializer.class)
    private TextAlignment textAlignment = TextAlignment.CENTER;

    private boolean showBarcodeText = true;


    public PdfExportGridColumn(String field, String label, int span) {
        this.field = field;
        this.label = label;
        this.span = span;
    }


    public PdfExportGridColumn(String field, String label, int span, boolean summary) {
        this.field = field;
        this.label = label;
        this.span = span;
        this.summary = summary;
    }

    public PdfExportGridColumn setLabel(String label) {
        this.label = label;
        return this;
    }
    public PdfExportGridColumn setTextShowType(TextShowType textShowType) {
        this.textShowType = textShowType;
        return this;
    }
}
